#include <REGX52.H>
#include "Delay.h"
#include "KeyPro.h"
#include "NixiePro.h"
#include "Timer0.h"

sbit DA=P2^1;

unsigned char Counter;//计数值
unsigned char Compare;//比较值
void main()
{
	unsigned char i;
	Timer0_Init();
	Compare = 50;
	while(1)
	{
		for(i=0;i<100;i++)
		{
			Compare=i;
			Delay(10);
		}
		for(i=100;i>0;i--)
		{
			Compare=i;
			Delay(10);
		}
		
	}
}

void Timer0_Routine() interrupt 1
{
	//100us
	TL0 = 0xA4;				//设置定时初始值
	TH0 = 0xFF;				//设置定时初始值
	Counter++;
	Counter%=100; // = if(Counter==100){Counter=0;}
	if(Counter<=Compare)
	{
		DA = 1;//1:工作
	}
	else
	{
		DA = 0;//0；停止
	}
}